//
//  CellForExtend.m
//  UI24_KVO_ NSNotificationCenter
//
//  Created by Scott on 16/1/14.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "CellForExtend.h"

@interface CellForExtend ()

@property (weak, nonatomic) IBOutlet UILabel *labelForName;

@property (weak, nonatomic) IBOutlet UIButton *buttonForDele;

@end

@implementation CellForExtend

- (void)awakeFromNib {
    // Initialization code
    
    // 圆角
    self.labelForName.layer.cornerRadius = 5;
    self.labelForName.layer.masksToBounds = YES;
    
    // 删除Button隐藏
    self.buttonForDele.hidden = YES;
    
    // 注册一个显示删除按键通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleShowDele:) name:@"showDele" object:nil];
    
    // 注册一个隐藏删除按键通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleHideDele:) name:@"hideDele" object:nil];
    
    
    
}


- (void)handleShowDele:(NSNotification *)noti {
    // 显示button
    self.buttonForDele.hidden = NO;
    
    [UIView animateWithDuration:0.15 animations:^{
        
        self.buttonForDele.transform = CGAffineTransformMakeScale(1.2, 1.2);
        
    } completion:^(BOOL finished) {
        
        self.buttonForDele.transform = CGAffineTransformIdentity;
    }];
    
}



- (void)handleHideDele:(NSNotification *)noti {
    
    self.buttonForDele.hidden = YES;
    
}






@end
